home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / make-367.lha / make-3.67 / mkinstalldirs < prev    next >
Text File  |  1993-05-22  |  616b  |  34 lines

  1. #!/bin/sh
  2. # Make directory hierarchy. 
  3. # Written by Noah Friedman <friedman@prep.ai.mit.edu>
  4. # Public domain.
  5.  
  6. defaultIFS='     
  7. '
  8. IFS="${IFS-${defaultIFS}}"
  9.  
  10. for file in ${1+"$@"} ; do 
  11.    oIFS="${IFS}"
  12.    # Some sh's can't handle IFS=/ for some reason.
  13.    IFS='%'
  14.    set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'`
  15.    IFS="${oIFS}"
  16.    test ".${1}" = "." && shift
  17.  
  18.    pathcomp=''
  19.  
  20.    while test $# -ne 0 ; do
  21.      pathcomp="${pathcomp}${1}"
  22.      shift
  23.  
  24.      if test ! -d "${pathcomp}"; then
  25.         echo "mkdir $pathcomp" 1>&2
  26.         mkdir "${pathcomp}"
  27.      fi
  28.  
  29.      pathcomp="${pathcomp}/"
  30.    done
  31. done
  32.  
  33. # eof
  34.